/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.bar.model.impl;

import com.bar.model.Mailing;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import java.io.Serializable;

import java.util.Date;

/**
 * The cache model class for representing Mailing in entity cache.
 *
 * @author pgonzalm
 * @see Mailing
 * @generated
 */
public class MailingCacheModel implements CacheModel<Mailing>, Serializable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(15);

		sb.append("{mailingId=");
		sb.append(mailingId);
		sb.append(", userName=");
		sb.append(userName);
		sb.append(", createDate=");
		sb.append(createDate);
		sb.append(", userSurname=");
		sb.append(userSurname);
		sb.append(", mailing=");
		sb.append(mailing);
		sb.append(", email=");
		sb.append(email);
		sb.append(", phone=");
		sb.append(phone);
		sb.append("}");

		return sb.toString();
	}

	public Mailing toEntityModel() {
		MailingImpl mailingImpl = new MailingImpl();

		mailingImpl.setMailingId(mailingId);

		if (userName == null) {
			mailingImpl.setUserName(StringPool.BLANK);
		}
		else {
			mailingImpl.setUserName(userName);
		}

		if (createDate == Long.MIN_VALUE) {
			mailingImpl.setCreateDate(null);
		}
		else {
			mailingImpl.setCreateDate(new Date(createDate));
		}

		if (userSurname == null) {
			mailingImpl.setUserSurname(StringPool.BLANK);
		}
		else {
			mailingImpl.setUserSurname(userSurname);
		}

		mailingImpl.setMailing(mailing);

		if (email == null) {
			mailingImpl.setEmail(StringPool.BLANK);
		}
		else {
			mailingImpl.setEmail(email);
		}

		mailingImpl.setPhone(phone);

		mailingImpl.resetOriginalValues();

		return mailingImpl;
	}

	public long mailingId;
	public String userName;
	public long createDate;
	public String userSurname;
	public boolean mailing;
	public String email;
	public long phone;
}